home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programmer Plus 2007
/
Programmer-Plus-2007.iso
/
Programming
/
Student most wanted Languages
/
Turbo C v3.0
/
Tc3setup.exe
/
EXAMPLES
/
INTRO34.CPP
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1992-02-18
|
428 b
|
22 lines
//INTRO34.CPP-Example from Chapter 3, "An Introduction to C++"
#include <iostream.h>
int main()
{
char name[40];
char *str_ptr = name;
int pos, num_chars;
cout << "Enter a string for the character array: ";
cin.get(name,40,'\n');
cout << "How many characters do you want to extract? ";
cin >> num_chars;
for (pos = 0; pos < num_chars; pos++)
cout << *str_ptr++;
cout << '\n';
return 0;
}